<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css"  href="/styles/general.css"/>
<link rel="stylesheet" type="text/css" href="/styles/main.css"/>
<link rel="stylesheet" type="text/css" href="/styles/validator.css"/>
<link rel="stylesheet" href="/themes/custom-theme/jquery.ui.all.css">
<script src="/js/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="/js/ui/jquery.ui.core.js" type="text/javascript"></script>
<script src="/js/ui/jquery.ui.widget.js" type="text/javascript"></script>
<script src="/js/ui/jquery.ui.tabs.js" type="text/javascript"></script>
<script src="/scripts/kedit/kindeditor-min.js" type="text/javascript"></script>
<script src="/scripts/kedit/lang/zh_CN.js" type="text/javascript"></script>
<script src="/js/formValidator.js" type="text/javascript"></script>
<script src="/js/formValidatorRegex.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
	$( "#tabs" ).tabs();
	$.formValidator.initConfig({formid:"myform",onerror:function(msg){alert(msg)}});
	//$("#casno").formValidator({onshow:"请输入CAS No.",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	//$("#compoundno").formValidator({onshow:"请输入内部编号",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	//$("#compoundname").formValidator({onshow:"请输入中文名",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	//$("#compoundnameen").formValidator({onshow:"请输入英文名",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	$("#projectid").formValidator({onshow:"请输入项目编号",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,empty:false, type:"value",onerror:"长度不正确,请确认"});
	$("#noteid").formValidator({onshow:"请输入试验记录本编号",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	$("#notepage").formValidator({onshow:"请输入页码",onfocus:"请至少要输入1个字符",oncorrect:"OK",defaultvalue:""}).inputValidator({min:1,onerror:"长度不正确,请确认"});
	var url = "/compound/checkno/";
	$("#compoundno").formValidator({onshow:"请输入内部编号",onfocus:"内部编号至少4个字符,最多30个字符",oncorrect:"内部编号可用"}).inputValidator({min:4,max:30,onerror:"你输入的内部编号不可用,请确认"})
    .ajaxValidator({
    type : "get",
	url : url,
	datatype : "json",
	success : function(data){
        if( data == "1" )
		{
            return true;            
		}
        else
		{
            return false;
		}		
	},
	buttons: $("#submit"),
	error: function(){alert("服务器没有返回数据，可能服务器忙，请重试");},
	onerror : "内部编号重复，请重新输入",
	onwait : "正在校验内部编号，请稍候..."
	}).defaultPassed();
	
var editor = KindEditor.create('textarea[name="synthesisdoc"]');
var editor1 = KindEditor.create('textarea[name="biodoc"]');
$("#btnspectrum").bind('click', function(event) {
	$("#wrapspectrum").append($("#linespectrum").html());
});
$("#btnreference").bind('click', function(event) {
	$("#wrapreference").append($("#linereference").html());
});
$("#btncompoundsave").bind('click', function(event) {
	$("#wrapcompoundsave").append($("#linecompoundsave").html());
});
$("#btngain").bind('click', function(event) {
	$("#wrapgain").append($("#linegain").html());
});
$("#tabs>ul>li>a").bind('click', function(event) {
	//$("#url").val($(this).attr("href"));
	if($(this).attr("href")!="#tabs-1"){
		$("#tabs-1").trigger('click');
		alert("请先保存基础信息！");
	}
});
$(".cantuse").bind('click', function(event) {
		alert("请先保存基础信息！");
		return false;
});
});

</script>
<title></title>
</head>
<body>
<h1>
<span class="action-span"><a href="/compound">管理化合物</a></span>
<span class="action-span1"> 添加化合物</span>
<div style="clear:both"></div>
</h1>
<div class="main-div">
  <form action="/compound/add/" method="post" name="myform" id="myform" enctype="multipart/form-data">
  <div id="tabs">
	<ul>
		<li><a id="tabs-1" href="#tabs-1">基本信息</a></li>
		<li><a href="#tabs-2">制备方法</a></li>
		<li><a href="#tabs-5">样品批次</a></li>
		<li><a href="#tabs-3">分析谱图</a></li>
		<li><a href="#tabs-6">生物活性</a></li>
		<li><a href="#tabs-7">参考文献</a></li>
		<li><a href="#tabs-4">相关成果</a></li>
	</ul>
	<div id="tabs-1">
	<table width="100%">
	  <tr>
        <td rowspan="17">
			{form chem * mol mol}
			<table>
				 <tr>
			        <td class="label">盐：</td>
			        <td>
			        	<a href="#" class="cantuse">+新增</a>
			        </td>
			        <td><div id='saltTip' style="width:250px"></div></td>
			      </tr>
			      <tr>
			        <td class="label">溶剂：</td>
			        <td>
			        	<a href="#" class="cantuse">+新增</a>
			        </td>
			        <td><div id='solventTip' style="width:250px"></div></td>
			      </tr>
			</table>
			<div id="cheminfo" style="width:370px;text-align:left">
			</div>
        </td>
        <td class="label">项目编号：</td>
        <td>
			{form select * projectid projectid * * * $projectlist}
        </td>
        <td><div id='projectidTip' style="width:250px"></div></td>
      </tr>
      <tr>
        <td class="label">CAS No.：</td>
        <td>{form text * casno casno}
        	
        </td>
        <td><div id='casnoTip' style="width:250px"></div></td>
      </tr>
      <tr>
        <td class="label">内部编号：</td>
        <td>
			{form text * compoundno compoundno $compoundno}
        </td>
        <td><div id='compoundnoTip' style="width:250px"></div></td>
      </tr>
      <tr>
        <td class="label">中文名：</td>
        <td>
			{form text * compoundname compoundname}
        </td>
        <td><div id='compoundnameTip' style="width:250px"></div></td>
      </tr>
      <tr>
        <td class="label">英文名：</td>
        <td>
			{form text * compoundnameen compoundnameen}
        </td>
        <td><div id='compoundnameenTip' style="width:250px"></div></td>
      </tr>
      <tr>
        <td class="label subtable">别名：</td>
        <td class="subtable">
			{form text * compoundnameother compoundnameother}
        </td>
        <td class="subtable"><div id='compoundnameotherTip' style="width:250px"></div></td>
      </tr>
      <!-- 
      <tr>
        <td class="label">分子式：</td>
        <td>
			{form text * formula formula}
        </td>
        <td><div id='smileTip' style="width:250px"></div></td>
      </tr>
      <tr>
        <td class="label">分子量：</td>
        <td>
			{form text * molecularweight molecularweight}
        </td>
        <td><div id='molecularweightTip' style="width:250px"></div></td>
      </tr> -->
     
      <tr>
        <td class="label">是否终产物：</td>
        <td>
			{form radio * product product}
        </td>
        <td><div id='productTip' style="width:250px"></div></td>
      </tr>
      <tr>
        <td class="label">是否专利保护：</td>
        <td>
			{form radio * patent patent * * * $patentlist}
        </td>
        <td><div id='patentTip' style="width:250px"></div></td>
      </tr>
      <tr>
        <td class="label">试验记录本编号：</td>
        <td>
			{form text * noteid noteid}
        </td>
        <td><div id='noteidTip' style="width:250px"></div></td>
      </tr>
      <tr>
        <td class="label">页码：</td>
        <td>
			{form text * notepage notepage}
        </td>
        <td><div id='notepageTip' style="width:250px"></div></td>
      </tr>
      
      <tr>
        <td class="label">外观性状：</td>
        <td>
			{form text * appearance appearance}
        </td>
        <td><div id='appearanceTip' style="width:250px"></div></td>
      </tr>
       <tr>
       
        <td class="label">溶解性：</td>
        <td>
			{form text * solubility solubility}
        </td>
        <td><div id='solubilityTip' style="width:250px"></div></td>
      </tr>
      <tr>
        <td class="label">熔点：</td>
        <td>
			{form text * meltingpoint meltingpoint}
        </td>
        <td><div id='meltingpointTip' style="width:250px"></div></td>
      </tr>
      <tr>
        <td class="label">沸点：</td>
        <td>
			{form text * boilingpoint boilingpoint}
        </td>
        <td><div id='boilingpointTip' style="width:250px"></div></td>
      </tr>
      <tr>
        <td class="label">稳定性：</td>
        <td>
			{form text * stability stability}
        </td>
        <td><div id='stabilityTip' style="width:250px"></div></td>
      </tr>
      <tr>
        <td class="label">旋光性：</td>
        <td>
			{form text * optical optical}
        </td>
        <td><div id='opticalTip' style="width:250px"></div></td>
      </tr>
      <tr>
        <td class="label">手性：</td>
        <td>
			{form text * chirality chirality}
        </td>
        <td><div id='chiralityTip' style="width:250px"></div></td>
      </tr>
      <!--
      <tr>
        <td class="label">LogP：</td>
        <td>
			{form text * logp logp}
        </td>
        <td><div id='logpTip' style="width:250px"></div></td>
      </tr>
     -->
     
  </table>  
	</div>
	<div id="tabs-2">
		<table width="100%">
		  <tr>
	        <td class="label">合成路线：</td>
	        <td>
				{form chem * synthesisroute synthesisroute * * 650}
	        </td>
	        <td><div id='synthesisrouteTip' style="width:250px"></div></td>
	      </tr>
	      <tr>
	        <td class="label">试验记录：</td>
	        <td>
				{form keditor * synthesisdoc synthesisdoc}
	        </td>
	        <td><div id='synthesisdocTip' style="width:250px"></div></td>
	      </tr>
	       <tr>
	        <td class="label"> 参考文献：</td>
	        <td>
	        	<div id="wrapreference">
		        	<div id="linereference">
		        		<div>
		        			<table width="100%" class="subtable">
							 <tr>
							    <td class="sublabel">名称：</td>
							    <td>
		        				{form textmulty * referencesname referencesname}
		        				</td>
							</tr>
							<tr>
								 <td class="sublabel">文件：</td>
							    <td>
								{form file * reference reference} 
								</td>
							</tr>
							</table>
						</div>
					</div>
				</div>
				<div class="botton">
				<a href="#" id="btnreference">增加参考文献</a>
				</div>
	        </td>
	        <td></td>
	      </tr>
		</table>
	</div>
	<div id="tabs-3">
		<table width="100%">
		  <tr>
	        <td class="label">谱图信息：</td>
	        <td>
				<div id="wrapspectrum">
		        	<div id="linespectrum">
		        		<div> 
		        			<table width="100%" class="subtable">
							 <tr>
							    <td class="sublabel">谱图类型：</td>
							    <td>
		        				{form selectmulty * spectrumtypeid spectrumtypeid * * * $spectrumtyps}
			        			 </td>
							</tr>
							<!--tr>
							    <td class="sublabel">谱图名称：</td>
							    <td>
		        				{form textmulty * spectrumname spectrumname}
		        				</td>
							</tr-->
							<tr>
							    <td class="sublabel">备注：</td>
							    <td>
		        				{form textmulty * spectrumdes spectrumdes}
		        				</td>
							</tr>
							<tr>
							    <td class="sublabel">文件：</td>
							    <td>
								{form file * spectrum spectrum}
								</td>
							</tr>
							</table>
						</div>
					</div>
				</div>
				<div class="botton">
				<a href="#" id="btnspectrum">增加谱图信息</a>
				</div>
	        </td>
	        <td></td>
	      </tr>
		</table>
	</div>
	<div id="tabs-4">
		<table width="100%">
		  <tr>
		<tr>
	        <td class="label"> 相关成果：</td>
	        <td>
	        	<div id="wrapgain">
		        	<div id="linegain">
		        		<div>
		        			<table width="100%" class="subtable">
							 <tr>
							    <td class="sublabel">成果名称：</td>
							    <td>
		        				{form textmulty * gainname gainname}
		        				</td>
							</tr>
							<tr>
								 <td class="sublabel">相关文档：</td>
							    <td>
								{form file * gain gain} 
								</td>
							</tr>
							</table>
						</div>
					</div>
				</div>
				<div class="botton">
				<a href="#" id="btngain">增加相关成果</a>
				</div>
	        </td>
	        <td></td>
	      </tr>
		</table>
	</div>
	<div id="tabs-5">
		<table width="100%">
		  <tr>
	        <td class="label"> 样品信息：</td>
	        <td>
				<div id="wrapcompoundsave">
		        	<div id="linecompoundsave">
		        		<div>
							  <table width="100%" class="subtable">
							      <tr>
							        <td class="sublabel">批次：</td>
							        <td>
										{form textmulty * batch batch}
							        </td>
							      </tr>
							      <tr>
							        <td class="sublabel">纯度%：</td>
							        <td>
										{form textmulty * purity purity}
							        </td>
							      </tr>
							      <tr>
							        <td class="sublabel">保存容器：</td>
							        <td>
										{form textmulty * container container}
							        </td>
							      </tr>
							      <tr>
							        <td class="sublabel">位置：</td>
							        <td>
										{form textmulty * location location}
							        </td>
							      </tr>
							      <tr>
							        <td class="sublabel">生产日期：</td>
							        <td>
										{form textmulty * producedate producedate}
							        </td>
							      </tr>
							  </table>  
						</div>
					</div>
				</div>
				<div class="botton">
				<a href="#" id="btncompoundsave">增加样品信息</a>
				</div>
	        </td>
	        <td></td>
	      </tr>
		</table>
	</div>
	<div id="tabs-6">
		<table width="100%">
	      <tr>
	        <td class="label">生物活性：</td>
	        <td>
				{form keditor * biodoc biodoc}
	        </td>
	        <td><div id='synthesisdocTip' style="width:250px"></div></td>
	      </tr>
		</table>
	</div>
  </div>
  <table width="100%" id="table_form"></table>
   <div class="button-div">
   		{form select * status status $info["status"] * 10 $statusList}
   		 &nbsp;&nbsp;&nbsp;&nbsp;
        <input type="submit" name="submit" id="submit" value="&nbsp;确&nbsp;定&nbsp;" />
        &nbsp;&nbsp;&nbsp;&nbsp;
        <input type="reset" value="&nbsp;重&nbsp;置&nbsp;" />
   </div>
  </form>
</div>
{template 'footer.html'}
</body>
</html>